package com.yiwei.zhh.impl;

import android.content.Context;

import com.yiwei.zhh.constant.Const;
import com.yiwei.zhh.http.CallBackListener;
import com.yiwei.zhh.http.InfoCallBack;
import com.yiwei.zhh.http.InterfaceServer;
import com.yiwei.zhh.interfaces.LiMuInfo;
import com.yiwei.zhh.model.LiMuApiKeyModel;
import com.yiwei.zhh.model.LiMuSignModel;
import com.yiwei.zhh.model.RequestModel;
import com.yiwei.zhh.model.ResponseModel;

import java.util.HashMap;

/**
 * Created by xsooy-pc on 2017/5/9.
 */

public class LiMuInfoImpl implements LiMuInfo {

    @Override
    public void getAboutInfo(Context context, String deal_id, InfoCallBack callBack) {
        HashMap hashMap = new HashMap();
        hashMap.put("deal_id", deal_id);
        RequestModel model = new RequestModel(hashMap);
        InterfaceServer.getInstance(context.getApplicationContext()).requestInterface(Const.LIMU_API_KEY, Const.RequestMethod.POST, model, Const.DEFAULT_TIMEOUT, new CallBackListener<LiMuApiKeyModel>(LiMuApiKeyModel.class, callBack));
    }

    @Override
    public void getSign(Context context, String params, InfoCallBack callBack) {
        HashMap hashMap = new HashMap();
        hashMap.put("params", params);
        RequestModel model = new RequestModel(hashMap);
        InterfaceServer.getInstance(context.getApplicationContext()).requestInterface(Const.LIMU_SIGN, Const.RequestMethod.POST, model, Const.DEFAULT_TIMEOUT, new CallBackListener<LiMuSignModel>(LiMuSignModel.class, callBack));
    }

    @Override
    public void uploadToken(Context context, String deal_id, String token, InfoCallBack callBack) {
        HashMap hashMap = new HashMap();
        hashMap.put("deal_id", deal_id);
        hashMap.put("token", token);
        RequestModel model = new RequestModel(hashMap);
        InterfaceServer.getInstance(context.getApplicationContext()).requestInterface(Const.LIMU_TOKEN, Const.RequestMethod.POST, model, Const.DEFAULT_TIMEOUT, new CallBackListener<ResponseModel>(ResponseModel.class, callBack));


    }


}
